package com.jstreams.utils;

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.Reader;
import java.io.Writer;

public class ConvertToBufferedUtils {

	/**
	 * InputStream 转换为 BufferedInputStream
	 * 
	 * @param in
	 * @return
	 */
	public static BufferedInputStream getBufferedInputStream(InputStream in) {
		return new BufferedInputStream(in);
	}

	/**
	 * OutputStream 转换为 BufferedOutputStream
	 * 
	 * @param out
	 * @return
	 */
	public static BufferedOutputStream getBufferedInputStream(OutputStream out) {
		return new BufferedOutputStream(out);
	}

	/**
	 * Reader 转换为 BufferedReader
	 * 
	 * @param in
	 * @return
	 */
	public static BufferedReader getBufferedReader(Reader in) {
		return new BufferedReader(in);
	}

	/**
	 * Writer 转换为 BufferedWriter
	 * 
	 * @param out
	 * @return
	 */
	public static BufferedWriter getBufferedWriter(Writer out) {
		return new BufferedWriter(out);
	}

	/**
	 * InputStreamReader 转换为 BufferedReader
	 * 
	 * @param in
	 * @return
	 */
	public static BufferedReader getBufferedReader(InputStreamReader isr) {
		return new BufferedReader(isr);
	}

	/**
	 * OutputStreamWriter 转换为 BufferedWriter
	 * 
	 * @param out
	 * @return
	 */
	public static BufferedWriter getBufferedWriter(OutputStreamWriter osw) {
		return new BufferedWriter(osw);
	}

}
